package com.itheima.mapper;

import com.github.pagehelper.Page;
import com.itheima.domain.pojo.Clazz;
import com.itheima.domain.query.QueryParam;
import com.itheima.domain.vo.PageResult;
import org.apache.ibatis.annotations.*;

import java.time.LocalDate;
import java.util.List;

/**
 * @Author:篍
 * @Date: 2025/07/10 18:56
 * @Description:
 */
@Mapper
public interface ClazzMapper {
    /**
     * 添加班级
     * @param clazz
     */
    @Insert("insert into clazz values (#{id}, #{name}, #{room}, #{beginDate}, #{endDate}, #{masterId}, #{subject}, #{createTime}, #{updateTime})")
    void addClazz(Clazz clazz);

    /**
     * 分页展示班级
     * @param
     * @param
     * @param
     * @return
     */

    Page<Clazz> findClazz(QueryParam queryParam);

    @Delete("delete from clazz where id=#{id}")
    void deleteClazzById(Integer id);

    @Select("select * from clazz where id=#{id}")
    Clazz findById(Integer id);

    @Update("update clazz set name=#{name},room=#{room},begin_date=#{beginDate},end_date=#{endDate},master_id=#{masterId},subject=#{subject} where id=#{id}")
    void updateClazz(Clazz clazz);

    List<Clazz> findAllClazz();
}
